import{
    apiResetCurrPassword,
    apiResetPassword,
    apiGetCurrentInfo
}from "./apiResetPassword"
// 重置当前用户密码
export const resetCurrPassword = (ev,param) => {
    apiResetCurrPassword(param)
        .then(
            (res) => {
                if(res.data.code==='S100101'){
                    ev.$message({
                        message: "密码修改成功",
                        type: "success"
                    });
                }else{
                    ev.$message({
                    message: "密码修改失败",
                    type: "error"
                });
            }
            ev.editPasswordModal=false;
        }
        )
}

// 重置密码
export const resetPasswordController = (ev,param) => {
    apiResetPassword(param)
        .then(
            (res) => {
                if(res.data.code==='S100101'){
                    ev.$message({
                        message: "密码重置成功",
                        type: "success"
                    });
                }else{
                ev.$message({
                    message: "密码修改失败",
                    type: "error"
                });
            }
            ev.resetPasswordData.newPass='';
            ev.resetPasswordData.newPassRepeat='';
            }
        )
}
// 获取当前登录用户的信息
export const getCurrentInfo = (ev) =>{
    apiGetCurrentInfo().then(
        (res)=>{
            ev.userForm.name = res.data.data.username;
            // ev.userForm.cellphone = res.data.data.mobile;
            // ev.initPhone = '17712345678';
            // ev.userForm.company = 'TalkingData';
            // ev.userForm.department = '可视化部门';
            ev.id=res.data.data.id;
        }
    )
}
